import React from 'react';
import { Row, Col } from 'antd';
import { connect } from 'react-redux';
function mapStateToProps(state) {
  console.log(state, 'state');
  return {
    codes: {
      ...state.code,
    },
  };
}
function strategyBaseDetail(props) {
  const modes = props.codes.strategy_mode;
  const { detail, name, mode, disabled } = props;
  return (
    <div className='strategy-component-detail' style={{ marginBottom: '30px' }}>
      {disabled && (
        <Row type='flex' style={{ lineHeight: '3' }} gutter={100}>
          <Col>
            <div className='tantuer-form-item2'>
              <div className='ant-form-item-label'>
                <label>节点名称</label>
              </div>
              <span>{name}</span>
            </div>
          </Col>
          <Col>
            <div className='tantuer-form-item2'>
              <div className='ant-form-item-label'>
                <label>节点模式</label>
              </div>
              <span>{(modes.find((it) => it.key === mode) || {}).value}</span>
            </div>
          </Col>
        </Row>
      )}
      <Row type='flex' style={{ lineHeight: '3' }} gutter={100}>
        <Col>
          <div className='tantuer-form-item2'>
            <div className='ant-form-item-label'>
              <label>组件名称</label>
            </div>
            <span>{detail.name}</span>
          </div>
        </Col>
        <Col>
          <div className='tantuer-form-item2'>
            <div className='ant-form-item-label'>
              <label>当前版本</label>
            </div>
            <span>{detail.version}</span>
          </div>
        </Col>
        <Col>
          <div className='tantuer-form-item2'>
            <div className='ant-form-item-label'>
              <label>创建人/修改人</label>
            </div>
            <span>
              {detail.createBy} / {detail.updateBy}
            </span>
          </div>
        </Col>
        <Col>
          <div className='tantuer-form-item2'>
            <div className='ant-form-item-label'>
              <label>修改时间</label>
            </div>
            <span>{detail.updateAt}</span>
          </div>
        </Col>
      </Row>
    </div>
  );
}
export default connect(mapStateToProps)(strategyBaseDetail);
